package com.loe.test.frag

import android.os.Bundle
import android.util.Log
import com.loe.mvp.BaseActivity
import com.loe.mvp.ext_app.addInFragment
import com.loe.mvp.ext_app.replaceFragment
import com.loe.mvp.ext_app.replaceInFragment
import com.loe.mvp.ext_app.setStatusText
import com.loe.test.R
import kotlinx.android.synthetic.main.activity_frag_test.*

class FragTestActivity : BaseActivity()
{
    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)
        setStatusText(true)
        setContentView(R.layout.activity_frag_test)

        initEvent()
    }

    override fun initEvent()
    {
        replaceInFragment(fragView, TestFragment1())

        buttonAdd.setOnClickListener()
        {
            addInFragment(fragView, TestFragment2(), "test")

            logFrag()
        }
    }

    private fun logFrag()
    {
        Log.d("runtime", "logFrag: " + supportFragmentManager.fragments.size)
    }

}